package com.wanter.compage.controller;

import com.wanter.compage.entity.ItemMenu;
import com.wanter.compage.service.ItemMenuService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 控制器
 * Created by er on 17-8-13.
 */
@Controller
@RequestMapping("/item/")
public class ItemMenuController {
    @Resource
    private ItemMenuService itemMenuService;
    private final Logger logger = Logger.getLogger(this.getClass());

    @RequestMapping("indexItem")
    @ResponseBody
    public List<ItemMenu> getIndexItemUrls() {
        List<ItemMenu> lists = itemMenuService.getWithNoLoginAllItem();
        if (lists == null) {
            lists = new ArrayList<>(0);
        }
        if (logger.isInfoEnabled()) {
            logger.info(this.getClass().getName() + "拿到的url集合为" + lists);
            logger.info(lists);
        }
        return lists;
    }

}
